package org.study.minio.boot.config;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.MediaType;

import javax.swing.filechooser.FileSystemView;

/**
 * 文件存储相关常量
 *
 * @author doveylovey
 * @version v1.0.0
 * @email 1135782208@qq.com
 * @date 2023年11月25日
 */
public interface MinioConstant {
    // 获取桌面路径
    String DESKTOP = FileSystemView.getFileSystemView().getHomeDirectory().getPath();
    // 通用mimeType：字节流
    String GENERAL_MEDIA_TYPE = MediaType.APPLICATION_OCTET_STREAM_VALUE;

    // 存储桶名称
    String BUCKET_DEFAULT = "bucket-default";
    String BUCKET_TEST = "bucket-test";

    // 存储目录
    String DIR_AVATAR = "avatar";
    String DIR_THUMBNAIL = "thumbnail";

    @Getter
    @AllArgsConstructor
    enum StatusCode {
        SUCCESS(20000, "操作成功"),
        PARAM_ERROR(40000, "参数异常"),
        NOT_FOUND(40004, "资源不存在"),
        FAILURE(50000, "系统异常"),
        CUSTOM_FAILURE(50001, "自定义异常错误"),
        ALONE_CHUNK_UPLOAD_SUCCESS(20001, "分片上传成功的标识"),
        ALL_CHUNK_UPLOAD_SUCCESS(20002, "所有的分片均上传成功");

        private final Integer code;
        private final String message;
    }
}
